package org.dromara.app.controller;

import java.util.List;

import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.bean.domain.vo.HisGoodsOrderEvaluateVo;
import org.dromara.bean.domain.bo.HisGoodsOrderEvaluateBo;
import org.dromara.bean.service.IHisGoodsOrderEvaluateService;
import org.dromara.common.mybatis.core.page.TableDataInfo;

/**
 * 商城订单评价
 *
 * @author Lion Li
 * @date 2024-12-26
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/goodsOrderEvaluate")
public class AHisGoodsOrderEvaluateController extends BaseController {

    private final IHisGoodsOrderEvaluateService hisGoodsOrderEvaluateService;




    /**
     * 新增商城订单评价
     */
    @Log(title = "商城订单评价", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public R<Void> add(@Validated(AddGroup.class) @RequestBody List<HisGoodsOrderEvaluateBo> bo) {
        return toAjax(hisGoodsOrderEvaluateService.insertByBo(bo));
    }


    /**
     * 获取商城订单评价详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<HisGoodsOrderEvaluateVo> getInfo(@NotNull(message = "主键不能为空")
                                              @PathVariable Long id) {
        return R.ok(hisGoodsOrderEvaluateService.queryById(id));
    }
}
